﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CapstoneProjectAEReader.Common.Utility;
using CapstoneProjectAEReader.Entities.Models;

namespace CapstoneProjectAEReader.Business.Manager
{
    public class NoteManager
    {
        #region Attributes

        private List<Note> _noteData = new List<Note>();
        private List<NoteDetail> _noteDetail = new List<NoteDetail>();

        #endregion

        #region Methods

        public NoteManager(List<Note> noteDt)
        {
            _noteData = noteDt;
        }

        /// <summary>
        /// Add new Note
        /// </summary>
        /// <param name="temp"></param>
        public void AddNote(Note temp)
        {
            //0: new, 1; existed
            int status = 0;
            if (_noteData.Any(e => e.NoteContent.Equals(temp.NoteContent, StringComparison.InvariantCultureIgnoreCase)))
            {
                status = 1;
            }
            if (status != 1)
            {
                _noteData.Add(temp);
            }
            else
            {
                //Note da ton tai. show warning message
            }
        }

        /// <summary>
        /// Update Note
        /// </summary>
        /// <param name="temp"></param>
        public void UpdateNote(Note temp)
        {
        }

        /// <summary>
        /// Delete Note
        /// </summary>
        /// <param name="temp"></param>
        public void DeleteNote(Note temp)
        {
            //TODO later
        }


        /// <summary>
        /// Order notes by specific way
        /// </summary>
        /// <param name="mode">order mode</param>
        /// <returns></returns>
        public List<Note> OrderNotes(int mode)
        {
            //TODO later
            return null;
        }

        /// <summary>
        /// Add Note Detail to Note
        /// </summary>
        /// <param name="root"></param>
        /// <param name="temp"></param>
        public void AddNoteDetail(Note root, NoteDetail temp)
        {
            //TODO later
        }

        /// <summary>
        /// Delete Note Detail
        /// </summary>
        /// <param name="temp"></param>
        public void DeleteNoteDetail(NoteDetail temp)
        {
            //TODO later
        }

        /// <summary>
        /// Update note detail
        /// </summary>
        /// <param name="temp"></param>
        public void UpdateNoteDetail(NoteDetail temp)
        {
            //TODO later
        }

        /// <summary>
        /// Search Note
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public List<Note> SearchNote(string text)
        {
            return null;
            //TODO later
        }

        #endregion
    }
}